﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpTrainer.Objects;
using Zeus.Thunder.Core;

namespace SharpTrainer.Collections
{
    class RemoveDuplicateTest : ITestCase
    {
        public void Run()
        {
            IList<Person> persons = new List<Person>();
            Person person;

            person = new Person
            {
                Name = "Tom",
                Age = 30
            };
            persons.Add(person);

            person = new Person
            {
                Name = "Alice",
                Age = 24
            };
            persons.Add(person);

            person = new Person
            {
                Name = "Jack",
                Age = 28
            };
            persons.Add(person);

            person = new Person
            {
                Name = "Tom",
                Age = 30
            };
            persons.Add(person);

            person = new Person
            {
                Name = "Jack",
                Age = 28
            };
            persons.Add(person);

            person = new Person
            {
                Name = "Peter",
                Age = 30
            };
            persons.Add(person);

            IQueryable<Person> tmpPersons = persons.AsQueryable();

            IQueryable<Person> discintcPersons = tmpPersons.Distinct<Person>(new PersonComparer());

            foreach (Person p in discintcPersons)
            {
                Console.WriteLine(p);
            }
        }
    }
}
